package Q242

import java.util.Arrays




class Main {

}

fun main() {
    val s = "anagram"
    val t = "nagaram"
    println(Solution().isAnagram(s, t))
}

class Solution {
    fun isAnagram(s: String, t: String): Boolean {
        val s1 = StringBuilder().append(s)
        val t1 = StringBuilder().append(t)

        return s1.reverse().toString().equals((t1.reverse().toString()))
    }
}

class Solution2 {
    fun isAnagram(s: String, t: String): Boolean {
        val chars = s.toCharArray()
        val chars1 = t.toCharArray()
        Arrays.sort(chars)
        Arrays.sort(chars1)
        return Arrays.equals(chars, chars1)
    }
}